package com.cln.salesTaxes;

import java.math.BigDecimal;
import java.math.MathContext;
import java.math.RoundingMode;

public class SalesTools {
	private static final BigDecimal ROUNDUP_FACTOR = new BigDecimal("0.05");

	/**
	 * Returns the value rounded up to the nearest 0.05
	 *
	 * @param double value to be rounded
	 * @return double rounded up value
	 */
	public static BigDecimal roundOff(BigDecimal value) {
		return value.divide(ROUNDUP_FACTOR).round(
				new MathContext(2, RoundingMode.UP)).multiply(ROUNDUP_FACTOR);
		//BigDecimal f=new BigDecimal(74.679999999999);
		//f = f.setScale( 2, BigDecimal.ROUND_HALF_UP );
	}
}
